namespace SimpleWebServices.Security.Principal
{
    using System;
    using System.Security.Principal;
    using System.Xml;
    using System.Xml.Schema;
    using System.Xml.Serialization;

    public sealed class AnonymousUser : IIdentity, IPrincipal, IXmlSerializable
    {
        public string AuthenticationType
        {
            get
            {
                return "None";
            }
        }

        public IIdentity Identity
        {
            get
            {
                return this;
            }
        }

        public bool IsAuthenticated
        {
            get
            {
                return false;
            }
        }

        public string Name
        {
            get
            {
                return "Guest";
            }
        }

        public bool IsInRole(string role)
        {
            return "guest".Equals(role, StringComparison.OrdinalIgnoreCase);
        }

        public XmlSchema GetSchema()
        {
            throw new NotSupportedException();
        }

        public void ReadXml(XmlReader reader)
        {
            if (null == reader)
            {
                throw new ArgumentNullException("reader");
            }

            throw new NotSupportedException();
        }

        public void WriteXml(XmlWriter writer)
        {
            if (null == writer)
            {
                throw new ArgumentNullException("writer");
            }

            throw new NotSupportedException();
        }
    }
}